import {Directive ,ElementRef,Input} from "@angular/core";

@Directive({
    selector:'[YellowBg2]'
})
export class YellowBg2{
    private _defaultColor='yellow';
    private el:HTMLElement;
    @Input('YellowBg2') 
    set backgroundColor(colorName:string){
        this.setStyle(colorName);
    }
    constructor(el:ElementRef){
        this.el=el.nativeElement;
        this.setStyle(this._defaultColor)
    }

    private setStyle(color:string){
        this.el.style.backgroundColor=color;
    }
}